////////////
//Make sure we load settings
window.addEventListener('load', clicktoplayOnLoad, false);

function clicktoplayOnLoad()
{
  var prefsService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
  var prefs = prefsService.getBranch("extensions.clicktoplay.");// Get the "clicktoplay." branch
  
  try{
      document.getElementById("clicktoplay-check").checked = prefs.getBoolPref('lastPlayOn');
  }catch (e){
      document.getElementById("clicktoplay-check").checked = false;
  }           
}

function clicktoplayAccept()
{
  var prefsService = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefService);
  var prefs = prefsService.getBranch("extensions.clicktoplay.");// Get the "clicktoplay." branch
  
  try{
    prefs.setBoolPref('lastPlayOn', document.getElementById("clicktoplay-check").checked );
  }catch (e){
      alert(e);
  }
}
////////////